import Mock from 'mockjs'
// 随机生成手机号数组
const tel = ['13653803755', '15617793826']
// 随机生成身份证号数组
const idCard = ['4123*****2512', '4247*****4624']

const certs = Mock.mock({
  'items|10': [
    {
      accountId: '@id',
      auditId: '@id',
      'auditStatus|1': ['待审核', '审核通过', '审核不通过'],
      'certificateType|1': ['身份证', '电工证', '营业执照'],
      'cardNum|1': idCard,
      'mobile|1': tel,
      name: '@cname',
      certTime: '@now()',
      pushTime: '@now()'
    }
  ]
})
const card = Mock.mock({
  'items|10': [{
    'craftTypes': [
      {
        'categoryId': '@id',
        'categoryName': '@cname',
        'craftCode': '@word',
        'craftLabel': '标签',
        'craftName': '@name',
        'isRelease|1': [0, 1],
        'notes': '@ctitle(5)',
        'workManualId': '@id',
        'workManualIds': '@id'
      }
    ],
    'certificateId': '@id',
    'certificateLabel': '高压,低压',
    'certificateCode': '@word',
    'certificateName': '卡包名称',
    'certificateType|1': ['身份证', '电工证', '营业执照'],
    'createTime': '@now()',
    'createUserId': '@id',
    'isRelease|1': [0, 1]
  }]
})

const dictMap = {

}
const pub = {
  endRow: 0,
  firstPage: 0,
  hasNextPage: true,
  hasPreviousPage: true,
  isFirstPage: true,
  isLastPage: true,
  lastPage: 0,
  navigatePages: 0,
  navigatepageNums: [],
  nextPage: 0,
  orderBy: '',
  pageNum: 0,
  pageSize: 10,
  pages: 0,
  prePage: 0,
  size: 0,
  totalNum: 30,
  pageIndex: 1,
  startIndex: 0,
  totalPage: 1
}

export default [
  // 证件审核
  // 02-02-3获取审核的证书
  {
    url: '/elec/certificate/audit/getCertificateAuditInfo',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: certs.items[0],
        msg: ''
      }
    }
  },
  // 02-02-3证件审核列表
  {
    url: '/elec/certificate/audit/listCertificateAudit',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...certs,
          ...pub
        },
        msg: ''
      }
    }
  },
  // 01-01-02分页查询卡包集合
  {
    url: '/elec/certificate/getCertificateListPage',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...card,
          ...pub
        },
        dictMap: dictMap,
        msg: ''
      }
    }
  },
  // 01-01-01根据id查询证书 lee
  {
    url: '/elec/certificate/getCertificateByid',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: {
          ...card.items[0]
        },
        dictMap: dictMap,
        msg: ''
      }
    }
  }, {
    url: '/elec/certificate/getCertificateList',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: [...card.items],
        dictMap: dictMap,
        msg: ''
      }
    }
  },

  // 01-01-05修改保存卡包
  {
    url: '/elec/certificate/modifyCertificate',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  // 01-01-06修改卡包发布状态
  {
    url: '/elec/certificate/releaseCertificate',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  },
  // 01-01-04新增保存卡包
  {
    url: '/elec/certificate/saveCertificate',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {},
        msg: ''
      }
    }
  }
]
